package com.tygz.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.auto.base.controller.SysRightsController;
import com.auto.base.pojo.SysRights;
import com.base.common.RequestParameters;
import com.tygz.service.SysRightsExtService;


@Controller
@RequestMapping("/sys/SysRightsExt")
public class SysRightsExtController extends SysRightsController {
	private final Logger log = LoggerFactory.getLogger(SysRightsExtController.class);
	@Resource
    public  SysRightsExtService service;
	/**
	 * 物理删除
	 * @return 
	 * {@link Param} records pks
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value = "dropExt")
	@ResponseBody
	public Object dropExt(@ModelAttribute final  RequestParameters requestParameters,String  records,HttpServletRequest request){
		try {
			List<SysRights> list = JSON.parseArray(records, SysRights.class);
			this.service.updateBetch(requestParameters.getPks(), list, getLoginSysUser(request));
			return setSuccess("更新成功!");
		} catch (Exception e) {
			log.error(e.getMessage(), e);
			return setException("更新失败!",e.getMessage());
		}
	}
}
